//{{AFX_INCLUDES()
#include "vsflexgrid.h"
//}}AFX_INCLUDES
#if !defined(AFX_DLGAXISMANGE_H__57BBB859_003C_425D_80BA_5226A51176B6__INCLUDED_)
#define AFX_DLGAXISMANGE_H__57BBB859_003C_425D_80BA_5226A51176B6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "DlgShowAxisNet.h"
#include "..\..\Inc\Center\WzdToolTipCtrl.h"

/////////////////////////////////////////////////////////////////////////////
// CDlgProjSettingsAxisNet dialog

class CDlgProjSettingsAxisNet : public CDialog
{
private:
	int		m_nKey   ;
	int		m_nCheck ;
 	CString	m_strOldVal ;
	int		m_nVsSetNetHeight;
 	HANDLE	m_hDraw ;
	BOOL    m_bNeedRead ;
 	CWzdToolTipCtrl m_tip;
	void	DrawAxis();
	int		CompareNumber(CString strNum1,CString strNum2);
	void	SetDlgItemState(int nNetPos);
	void	DelAxisNet(int nDelPos);
	void	InitCancelInfo(CANCEL_INFO* pNode,int nOpType,LPCTSTR szHint);
	void	RedoNewAxisNet(CANCEL_INFO* pNode);
	void	CancelSetProp(CANCEL_INFO* pNode );
	void	RedoSetProp(CANCEL_INFO* pNode );
	int 	GetAxisLine(CString strNum,sMainAxis &tAxis,int &nDis);
	void	CancelDelAxisLine(CANCEL_INFO* pNode);
	void	MoveRowUp(int nMoveRow);
	void	MoveRowDown(int nMoveRow);
	BOOL	Resort();
	void	RedrawSelAxis();
private:
	BOOL	CheckLineCount(int nPos);
	int		SaveAxis();
	int		ReadAxis();
	void	ReadOneAxis(int nAxisID);
	void	InitAxis(sMainAxis oCurAxis);
	void	ReadOneZW(int ZWID);
	void	EnableButtons(BOOL bEnable);
	bool	CreateNextNumber(bool bAddNum,CString& strVal);	
	bool	FindSameAxisNumber(CString strNum);
	void	Write();
	void	ShowMessage(char* str);
	BOOL	FindJinSNumber(int nPos,CString strNum);
	BOOL	FindKaiJNumber(int nPos,CString strNum);
	BOOL	CheckNumber( CString strVal,CString& strErr);
	void	ToJj(CString& strVal);
	BOOL	CheckEditValue();
	int		GetAxisID(int nNetID,LPCTSTR strNum);
	BOOL	AxisLinkJoinPoint(int nNetID,LPCTSTR pAxisBh);
	void	SwitchAxisNet(int nNetPos);
	void	SetAxisList(int nCheck,bool bFillData);
private:
	BOOL				m_bExecutedClear ;
	CDlgShowAxisNet*	m_DlgShowAxisNet ;

 	void	FillAxisList(int nSelRow=-1);
	void	UpdateNetLineBH(int nCurRow);
	void	NetLineBH(CString sOldBH, BOOL CzZxB,CString &sNewNetLineBH);
	void	GetNewNetStartKaiJNum(char* szNum);
	void	AddAxisLine(CString sJJ,BOOL bCancelRedo);
	void	SetNormalVal(int nFlg);
	void	DeleteAxisLine(int nCurRow);
public:
	int     m_nNetPos		;
 	BOOL	m_bCancelSel	;
	void	Clear();
	void	Read();
	void	Cancel(CANCEL_INFO* pNode);
	void	Redo(CANCEL_INFO* pNode);
	void	FullMap();
	void	MoveMap();
	void	BigMap();
	void	SmallMap();
	void	OnExit();
public:
	CDlgProjSettingsAxisNet(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CDlgProjSettingsAxisNet)
	enum { IDD = IDD_Dlg_Proj_Settings_AxisNet };
	CVSFlexGrid	m_VsNormalVal1;
	CVSFlexGrid	m_Vs;
	CVSFlexGrid	m_VsOther;
	UINT	m_nDis;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDlgProjSettingsAxisNet)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CDlgProjSettingsAxisNet)
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnBeforeEditVSSetNet(long Row, long Col, BOOL FAR* Cancel);
	afx_msg void OnCellChangedVSSetNet(long Row, long Col);
	afx_msg void OnBeforeEditVSSetOther(long Row, long Col, BOOL FAR* Cancel);
	afx_msg void OnCellChangedVSSetOther(long Row, long Col);
	afx_msg void OnDblClickVSNormalVal1();
	afx_msg void OnBUTTONAddAxisLine();
	afx_msg void OnBUTTONDelAxisLine();
	afx_msg void OnBUTTONMoveUp();
	afx_msg void OnBUTTONMoveDown();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnClickVSSetNet();
	afx_msg void OnClickVSSetOther();
	afx_msg void OnRADIOKaiJ();
	afx_msg void OnRADIOJinS();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBeforeSelChangeVSSetNet(long OldRowSel, long OldColSel, long NewRowSel, long NewColSel, BOOL FAR* Cancel);
	afx_msg void OnBeforeSelChangeVSSetOther(long OldRowSel, long OldColSel, long NewRowSel, long NewColSel, BOOL FAR* Cancel);
	afx_msg void OnKeyDownEditVSSetNet(long Row, long Col, short FAR* KeyCode, short Shift);
	afx_msg void OnDestroy();
	afx_msg void OnAfterSelChangeVSSetNet(long OldRowSel, long OldColSel, long NewRowSel, long NewColSel);
	afx_msg void OnClickVSNormalVal1();
	afx_msg void OnAfterSelChangeVSNormalVal1(long OldRowSel, long OldColSel, long NewRowSel, long NewColSel);
	DECLARE_EVENTSINK_MAP()
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnCbnSelendokComboNetName();
	afx_msg void OnBnClickedButtonSetName();
	afx_msg void OnBnClickedButtonAddNet();
	afx_msg void OnBnClickedButtonDelNet();
public:
	afx_msg void OnClickVsNormalval1();
	afx_msg void OnBnClickedButtonResort();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGAXISMANGE_H__57BBB859_003C_425D_80BA_5226A51176B6__INCLUDED_)
